/*
 * vector3D.h
 *
 *  Created on: June 23, 2011
 *      Authors: Lane Aasen, Nikholas Gaffney, Michael Rosenberger, Dylan Swiggett
 */

#include <math.h>

#ifndef VECTOR3D_H_
#define VECTOR3D_H_

typedef struct {
	double x, y, z;
} Vector3D;

/*
 * Construct a new Vector3D struct using the input values for x, y and z.
 */
Vector3D initVector3D (double x, double y, double z);

/*
 * Return the magnitude (length) of the vector in 3D space.
 */
double magnitudeVector3D (Vector3D v);

/*
 * Multiply x, y and z values by scalar, then return.
 */
Vector3D scaleVector3D (Vector3D v, double scalar);

/*
 * Scales the vector by the scalar in place, i.e. without returning a new vector
 */
void scaleIPVector3D (Vector3D* v, double scalar);

/*
 * Return a vector with the same direction and a magnitude of 1.
 */
Vector3D normalizeVector3D (Vector3D v);

/*
 * Return the sum of the two vectors.
 */
Vector3D addVector3D(Vector3D v1, Vector3D v2);

/*
 * Subtract the second vector from the first, and return the result.
 */
Vector3D subtractVector3D (Vector3D v1, Vector3D v2);

/*
 * Return the dot product of the two vectors.
 */
double dotProductVector3D (Vector3D v1, Vector3D v2);

/*
 * Return the cross product of the two vectors.
 */
Vector3D crossProductVector3D (Vector3D v1, Vector3D v2);

/*
 * Return a pointer to a duplicate of the original vector.
 */
Vector3D duplicateVector3D(Vector3D *v);

/*
 * Return the sum of the x, y and z values within the vector.
 */
double sumSideLengthsVector3D(Vector3D v);

#endif /* VECTOR3D_H_ */
